<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品列表">
</@frame.head>
<script type="text/javascript" src="${contextPath}/resources/js/tool/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/comm.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/select/py.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/select/Popt.js"></script>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/select/jquery.searchableSelect.css" />
<script type="text/javascript">
var path="${contextPath}";
</script>
<style>
/*后台tab菜单*/
.admin_tab{border-bottom:1px solid #ddd;height:40px;margin-top:10px}
.admin_tab a{float:left;padding:8px 15px;background:#fbfbfb;border:solid #ddd;border-width:1px 1px 0;margin-left:-1px;height:22px;}
.admin_tab .admin_tab_firstli a{margin-left:0}
.admin_tab .current,.admin_tab a:hover{height:22px;border-bottom:1px solid  #fbfbfb;margin-bottom:-1px;position:relative;}
.admin_tab li{float:left;}
.admin_tab_content{border:1px solid #ddd;border-top-width:0;padding:10px;}
/*缩略图div*/
.div_show{float:left;background-color: #cccccc; width: 200px;height: 200px; border: 1px;display: inline-block; position: relative;}
.div_show img{ width: 200px;height: 200px;}
.div_show .delete{position: absolute;top: 0px; right: 0px;width: 40px; height: 40px;font-size: 36px;display:none;color:red;}
.edit_table td:nth-child(1){width:10%;}
.edit_table td{width:22%;}
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 促销管理 <span class="c-gray en">&gt;</span> 发布赠品信息 </nav>
<div class="page-container">
    		<form action="${contextPath}/present/save_present" method="post" onsubmit="return toCheck(0)" enctype="multipart/form-data" >
                               <ul class="admin_tab">
							        <li >
										 <a id="admin_tab_one" href="javascript:void(0)" onclick="next(0)" class="current" >赠品信息</a>
									</li>
                                    <li >
										<a id="admin_tab_two"  href="javascript:void(0)" onclick="next(1)"  >详细图片</a>
									</li>
								    <li  >
										<a id="admin_tab_three" href="javascript:void(0)" onclick="next(2)"  >赠品详情</a>
									</li>
									<li>
										<a id="admin_tab_four" href="javascript:void(0)" onclick="next(3)" >规格参数</a>
									</li>
								</ul>
						  <div class="admin_tab_content" id="release">
                          <!-- tab1 start -->
						  <div>
                            <table class="table edit_table">
                            
                             <tr>
                               <td>赠品名称：</td> <td colspan="1">  <input type="text" class="input-text  radius"  name="name" onblur="isProduct()" maxlength="50"  value="${product.baseInfo.name}" /> </td>
                               <td><font color="red">*</font><span id="message" style="color:red; " >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>  </td>
                            </tr>
                            
                            
                             <tr id="storeNum">
                               <td>赠品库存：</td>
                               <td><input type="text" class="input-text  radius" id="saleStock"  name="saleStock" value="${(stockNum?c)!}" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"/> </td>
                               <td><font color="red">*</font></td>
                               <td></td>
                               <td></td>
                            </tr>
                            
                            <tr>
                               <td>赠品重量：</td>
                               <td><input type="text"  class="input-text  radius"  name="weight"   value="${(product.baseInfo.weight?c)!}"  /> </td>
                               <td>kg</td>
                               <td></td>
                               <td></td>
                            </tr>
                            
                            <tr>
                               <td>所属供应商：</td>
                               <td>
                               <span  class="select-box radius" >
                 	           <select class="select" id="mercId"  name="merchantId" >
	                           <option value="0" >--请选择--</option> 
                               <#list merchantList as merchant> 
									 <option value="${merchant.id?c}" <#if merchant.id==product.merchant.id>selected</#if>>${merchant.mercName}</option>
					           </#list>
	                           </select>
	                           </span>
                               </td>
                               <td><font color="red">*</font></td>
                               <td></td>
                               <td></td>
                            </tr>
                            
                          
                             <tr>
                               <td>参考价格：</td>
                               <td><input type="text" class="input-text  radius" id="payOneMileage" name="price"  value="${(product.priceInfo.payOneMileage?c)!}" /></td> 
                               <td>公里  </td>
                               <td></td>
                               <td></td>
                            </tr>
						
                          </table>
                            
                              <input type="button" class="btn btn-primary radius" onclick="checkSpecs()" name="下一步"  value="下一步"  /> 
									
						   </div>
		<div>
		
         <table class="tab_iframe">
	        <tr>
	        <td>
	          <div  id="show_0" class="div_show">
	            <img/>
	           <a href="javascript:;">
                 <div class="delete icon Hui-iconfont Hui-iconfont-del3"  data-id="0" ></div>
               </a>
	          </div> 
	        </td>
	        <td>
	           <div  id="show_1" class="div_show">
	           <img/>
	           <a href="javascript:;">
                 <div class="delete icon Hui-iconfont Hui-iconfont-del3"  data-id="1" ></div>
               </a>
	           </div> 
	        </td>
	         <td> 
	          <div  id="show_2" class="div_show" >
                 <img/>
	           <a href="javascript:;">
                 <div class="delete icon Hui-iconfont Hui-iconfont-del3"  data-id="2" ></div>
               </a>	
	          </div> 
	        </td>
	        </tr>
	        <tr>
	           <td><input type="file" name="image" size="1" value="" id="addImage0" class="addImage" data-id="show_0"></td>
     		   <td><input type="file" name="image" size="1" value="" id="addImage1" class="addImage" data-id="show_1"></td>
	           <td><input type="file" name="image" size="1" value="" id="addImage2" class="addImage" data-id="show_2"></td>
	        </tr><tr><td><br></td></tr>
	        <tr>
	        <td>
              <div  id="show_3" class="div_show" >
	             <img/>
	           <a href="javascript:;">
                 <div class="delete icon Hui-iconfont Hui-iconfont-del3"  data-id="3"></div>
               </a>   
              </div> 
            </td>
            <td>
               <div  id="show_4" class="div_show" >
	            <img/>
	           <a href="javascript:;">
                 <div class="delete icon Hui-iconfont Hui-iconfont-del3"  data-id="4"></div>
               </a>              
               </div> 
	        </td>
	        </tr>
            <tr>
             <td><input type="file" name="image" size="1" value="" id="addImage3" class="addImage" data-id="show_3"></td>   	  
	         <td><input type="file" name="image" size="1" value="" id="addImage4" class="addImage" data-id="show_4"></td>
            </tr><tr><td><br></td></tr>
	      </table> 
   	  <div id="colorSize" style="display:none;" >

	   </div>
			<input type="button" class="btn btn-primary radius"  onclick="next(0)" name="上一步"  value="上一步"  /> <input class="btn btn-primary radius" type="button" onclick="next(2)" name="下一步"  value="下一步"  /> 			
		
		</div>
	   <!-- tab2 end -->		
									
		
	   <!-- tab3 start -->		
		<div >
	     <table class="tab_iframe">
     		<tr>
     	    <td>
     		 <textarea cols="80" id="content" name="desc">${product.baseInfo.proDetail}</textarea> 
             <script type="text/javascript">
      	        CKEDITOR.replace('content',{filebrowserUploadUrl : path+'/ckeditor/uploader?Type=File&prodId=1111&uploadModel=product',filebrowserImageUploadUrl : path+'/ckeditor/uploader?Type=Image&prodId=${1111}&uploadModel=product',filebrowserFlashUploadUrl : path+'/ckeditor/uploader?Type=Flash&prodId=${1111}&uploadModel=product'});
             </script>
     		</td>
     		</tr>
     	 </table>
     	 <input type="button" class="btn btn-primary radius"  onclick="next(1)" name="上一步"  value="上一步"  /> <input class="btn btn-primary radius"  type="button" onclick="next(3)" name="下一步"  value="下一步"  /> 		
	  </div>
	   <!-- tab3 end -->

	 
	    <!-- tab4 start -->	
	    <div>
            <div class="right_input">
            
            
			</div>
			<input type="button" class="btn btn-primary radius"  onclick="next(2)" name="上一步"  value="上一步"  /> <input  class="btn btn-success radius"  type="submit" value="提交" />
	    </div>
	    
     	 <!-- tab4 start -->		
		</div>
	    </form>	
	    <iframe name="hidden_frame" style="display:none;"></iframe>
</div>
<@frame.end "default">
</@frame.end>
</html>
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/select/jquery.searchableSelect.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/present/add_or_update_present.js"></script>
<script  type="text/javascript" >
var typeId="${product.typeId!'0'}";
var path="${contextPath}";
$(document).ready(function(){
  <#if imageList?? && imageList?size &gt; 0>
    <#list  imageList as image>
    <#if image?? >
       var img= $("#show_${image.sequences}").children("img");
       img.attr("src","${imagePath}/shop/product/${image.prodId}/${image.image}");
       img.attr("data-type","1");
     <#else>
       img.attr("src","${webSite}/admin/images/no_img.jpg");
       img.attr("data-type","0");
    </#if>
    </#list>
 </#if> 
});
function callback(flag, message) {
	layer.closeAll('loading');
	if (flag == true) {
		layer.msg('操作成功!', {
			icon : 1,
			time : 1000
		}, function() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.search();
			parent.layer.close(index);
		});
	} else {
		layer.alert(message);
	}
}
function callback2(flag, message) {
	layer.closeAll('loading');
	if (flag == true) {
		window.location = path + "/product/query_product";
	} else {
		layer.alert(message);
	}
}
</script>